import $http from '@/utils/request.js'
import dayjs from 'dayjs'
const endTime = dayjs(new Date().valueOf()).format('YYYY-MM-DD')
const yueTime = dayjs(new Date().valueOf()).format('YYYY-MM')
// 策略管理
export const policyManagementAPI = (params) => {
  return $http({
    url: '/api/vm-service/policy/search',
    params
  })
}
// 策略管理添加
export const tacticsaddAPI = (data) => {
  return $http({
    url: '/api/vm-service/policy',
    method: 'POST',
    data
  })
}
// 策略管理查看
export const tacticsviewAPI = (id, params) => {
  return $http({
    url: `/api/vm-service/policy/vmList/${id}`,
    params
  })
}
// 策略管理修改
export const tacticsEditAPI = (id, data) => {
  return $http({
    url: `/api/vm-service/policy/${id}`,
    method: 'PUT',
    data
  })
}
// /api/vm-service/policy/:policyId
// 策略管理删除
export const tacticsDeleAPI = (id) => {
  return $http({
    url: `/api/vm-service/policy/${id}`,
    method: 'DELETE'
  })
}
// 订单管理
export const orderManagementAPI = (params) => {
  return $http({
    url: '/api/order-service/order/search',
    params
  })
}
// 对账统计
// 日销售统计 当日销售量（个） 111
export const salesStatistics = () => {
  return $http({
    url: `/api/order-service/report/orderCount?start=${endTime}+00:00:00&end=${endTime}+23:59:59`
  })
}

// 合作商
export const constpartnersAPI = () => {
  return $http({
    url: '/api/user-service/partner/search?pageIndex=1&pageSize=100000'
  })
}
// 月销售统计,当月销售量（个）
export const salesAPI = () => {
  return $http({
    url: `/api/order-service/report/orderCount?start=${yueTime}-01+00:00:00&end=${endTime}+23:59:59`
  })
}
// 月销售统计, 当日销售额（元）11
export const salesyuanAPI = () => {
  return $http({
    url: `/api/order-service/report/orderAmount?start=${endTime}+00:00:00&end=${endTime}+23:59:59`
  })
}
// 月销售统计, 当日分成（元） 11
export const dividedOnTheDayAPI = () => {
  return $http({
    url: `/api/order-service/report/totalBill?start=${endTime}+00:00:00&end=${endTime}+23:59:59`
  })
}
// 笔数统计：
export const numberOfPensAPI = () => {
  return $http({
    url: `/api/order-service/report/orderAmount?start=${yueTime}-01+00:00:00&end=${endTime}+23:59:59`
  })
}

// 收入统计
export const revenueAPI = () => {
  return $http({
    url: `/api/order-service/report/orderAmount?start=${yueTime}-01+00:00:00&end=${endTime}+23:59:59`
  })
}
// 分成统计
export const divideIntoAPI = () => {
  return $http({
    url: `/api/order-service/report/totalBill?start=${yueTime}-01+00:00:00&end=${endTime}+23:59:59`
  })
}
// 合作商
export const partners = (params) => {
  return $http({
    url: '/api/order-service/report/partnerCollect',
    params
  })
}

export const numberOfCounts = (params) => {
  return $http({
    url: `/api/order-service/report/orderCount`,
    params
  })
}
// 收入统计
export const incomeStatistics = (params) => {
  return $http({
    url: `/api/order-service/report/orderAmount`,
    params
  })
}
// 分成统计
export const splitIntoStatistics = (params) => {
  return $http({
    url: `/api/order-service/report/totalBill`,
    params
  })
}
// 主体
export const principalAPI = (params) => {
  return $http({
    url: `/api/order-service/report/partnerCollect`,
    params
  })
}
